﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace welding
{
    public partial class SuspendReason : Form
    {
        string[] reasons;
        public string reason;
        public SuspendReason(string[] reasons)
        {
            InitializeComponent();
            this.reasons = reasons;
        }

        private void SuspendReason_Load(object sender, EventArgs e)
        {
            if (reasons == null) return;
            for (int i = 0; i < this.reasons.Length; i++)
            {
                if (reasons[i].Trim() != string.Empty)
                    lbReasons.Items.Add(reasons[i]);
            }
        }

        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (lbReasons.SelectedIndex >= 0)
            {
                reason = lbReasons.Items[lbReasons.SelectedIndex].ToString();
                DialogResult = DialogResult.OK;
                this.Close();
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
